﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;

namespace InfoWykaz
{
    public class Serialize
    {
        public static void SerializeToXml(OptionsValue g, FileInfo fi)
        {
            using (TextWriter tw = new StreamWriter(fi.FullName))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(OptionsValue));
                serializer.Serialize(tw, g);
            }
        }

        public static OptionsValue DeserializeFromXml(FileInfo f)
        {
            using (FileStream fs = new FileStream(f.FullName, FileMode.Open))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(OptionsValue));
                OptionsValue ci = (OptionsValue)serializer.Deserialize(fs);
                return ci;
            }
        }
    }
}
